package cn.com.taiji.oospub.wechat.entity;


import cn.com.taiji.oospub.wechat.common.Finals;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.github.dreamyoung.mprelation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.List;

/**
 * <p>
 * 菜品表
 * </p>
 *
 * @author 
 * @since 2020-10-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("Courses")
@AutoLazy
public class Courses implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     *主键
     */
    private String id;
    /**
     * 项目外键
     */
    private String schoolId;

    @TableField(exist = false)
    @EntityMapper
    @Lazy
    @ManyToOne
    @JoinColumn(name = "school_id",referencedColumnName = "ID")
    private SchoolBaseInfo school;

    /**
     * 中文名
     */
    private String nameCh;

    /**
     * 英文名
     */
    private String nameEn="unknown";

    /**
     * 描述
     */
    private String description;

    /**
     * 菜品分类外键
     */
    private String coursesTypeId;

    @TableField(exist=false)
    @ManyToOne
    @JoinColumn(name="courses_type_id",referencedColumnName = "id")
    @EntityMapper
    @Lazy
    private CourseType courseType;

    /**
     * 餐次外键（1.早餐2.午餐3.晚餐）
     */
    private String mealTimeId;

    /**
     * 是否删除
     */
    private Boolean isDelete;

    /**
     * 有效期开始时间
     */
    @TableField("startTime")
    private LocalDateTime startTime;

    /**
     * 有效期结束时间
     */
    @TableField("endTime")
    private LocalDateTime endTime;

    /**
     * 编辑人
     */
    private String userName;

    /**
     * 编辑时间
     */
    private Calendar lastChanged;

    /**
     * 计划生产份数
     */
    private Double planProductCount;

    /**
     * 售价
     */
    private Double price;

    /**
     * 剩余份数
     */
    private Double remainCount=0.0;

    /**
     * 菜品编号
     */
    @TableField("pos_no")
    private String posNo;

    private String imageMainPath;

    private String isTop;

    /**
     * 1.菜品2.外卖3.两者
     */
    private Finals.MealType type;

    /**
     * 是否停售
     */
    private String isStop;

    /**
     * 餐次名称
     */
    private String mealName;

    private String mealTimeCode;

    @TableField("posUse")
    private String posUse;

    @TableField("dateType")
    private PosUse dateType;

    @TableField("businessCode")
    private String businessCode;

    @TableField("businessName")
    private String businessName;

    @TableField("PosUnit")
    private String PosUnit;

    @TableField("useTime")
    private LocalDateTime useTime;

    @TableField("recipeId")
    private String recipeId;

    @TableField("yearStr")
    private String yearStr;

    @TableField("monthStr")
    private String monthStr;

    @TableField("dateStr")
    private String dateStr;

    @TableField("SetMenu")
    private Integer setMenu;

    @TableField("day_ID")
    private Integer dayId;

    private String max;

    private String isSync;

    private String restaurantId;

    private String Portionsize;

    //临时字段
    @TableField(exist = false)
    private String priceStr;
    @TableField(exist = false)
    private List<String> logoImgs;
    @TableField(exist = false)
    private List<CourseNutrition> cnList;
    @TableField(exist = false)
    private List<CourseNutrition> cnWaiMaiList;
    @TableField(exist = false)
    private List<CourseNutrition> yDCnList;
    @TableField(exist = false)
    private List<RecipeMaterialNum> recipeMaterialNumList;


    @TableField(exist = false)
    private String dkLogo="";
    @TableField(exist = false)
    private String dyLogo="";
    @TableField(exist = false)
    private String dzLogo="";
    @TableField(exist = false)
    private String gwLogo="";
    //销售数量
    @TableField(exist = false)
    private Integer num=0;
    //是否在售
    @TableField(exist = false)
    private boolean isSell;
    //是否今日菜品
    @TableField(exist = false)
    private boolean isTodayCourse;
    @TableField(exist = false)
    private String descriptionImg;


    //菜品图片
    @TableField(exist = false)
    private List<CoursesImg> coursesImgList;


    public enum PosUse
    {
        KY("可用"){},
        BKY("不可用"){};
        @JsonValue
        private String value;

        private PosUse(String value)
        {
            this.value = value;
        }

        public String getValue()
        {
            return value;
        }
    }


}
